
public abstract class CookingMeat {

    protected final void cooking() {

        this.putOil();

        this.putMeat();

        this.stirFry();

        this.putSalt();

        if (this.needSeasoning()) {
            this.putSeasoning();
        }

        this.dishUp();

        
    }

    final void putOil() {
            System.out.println("油下锅了");
    }

    final void putMeat() {
        System.out.println("菜下锅了");
    }

    final void stirFry() {
        System.out.println("正在翻炒");
    }

    final void putSalt() {
        System.out.println("放点盐");
    }

    abstract void putSeasoning();
    
    protected boolean needSeasoning() {
        return true;
    }

    final void dishUp() {
        System.out.println("菜炒好了，可以起锅了");
    }
}